package com.ilancuo.json;

import org.json.JSONObject;

import java.util.Iterator;

/**
 * Json解析key不确定的数据
 * <p>
 * Created by ilancuo on 2016/12/15.
 */
public class JsonTest {

    private static final String JSON = "{\"11:00\":\"11\", \"12:00\": \"12\", \"13:00\": \"13\", \"14:00\": \"14\", \"15:00\": \"15\", \"16:00\": \"16\", \"17:00\": \"17\"}";

    public static void main(String... args) {
        JSONObject json = new JSONObject(JSON);
        Iterator<String> keys = json.keys();
        while (keys.hasNext()) {
            String key = keys.next();
            Object value = json.get(key);
            System.out.println("key: " + key + ", value: " + value);
        }
    }
}
